﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Base.Data.Migrations
{
    public partial class add_t_role_org : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "filter_org_type",
                table: "t_role",
                type: "integer",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "t_role_org",
                columns: table => new
                {
                    id = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    role_id = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
                    role_org_id = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
                    org_id = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
                    create_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    modify_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    is_deleted = table.Column<bool>(type: "boolean", nullable: false),
                    row_version = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_role_org", x => x.id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_t_role_org_create_time",
                table: "t_role_org",
                column: "create_time");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "t_role_org");

            migrationBuilder.DropColumn(
                name: "filter_org_type",
                table: "t_role");
        }
    }
}
